const fp = require('lodash/fp')
const { Maybe } = require('./support')

let user = { id: 2, name: 'Albert' }

let safeProp = fp.curry(function (x, o) {
  return Maybe.of(o[x])
})

/**
 *
 * @param {Obejct} obj 一个对象
 */
const ex3 = obj => {
  return safeProp('name', obj).map(fp.first)
}

console.log('执行ex3的结果为', ex3(user))
